<template>
  <div>
    <h3 style="margin:20px 0;">添加角色</h3>
    <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="角色名称" id="boxEl">
          <el-input
            v-model="form.name"
            placeholder="A01轻型步兵战车"
          ></el-input>
        </el-form-item>
     
      <el-form-item label="描述信息">
        <el-input
          type="textarea"
          v-model="form.desc"
          id="elWen"
          placeholder="请输入描述信息"
        ></el-input>
      </el-form-item>
      <el-tree
        :data="data"
        show-checkbox
        node-key="id"
        :default-expanded-keys="[2, 3]"
        
        :props="defaultProps">
      </el-tree>
      <el-form-item>
        <el-button>取消</el-button>
        <el-button type="primary" @click="onSubmit">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<style scoped>

</style>
<style >
#elWen {
  width: 900px;
  height: 100px;
}
#boxEl{
  width:400px;
}
</style>
<script>
export default {
  data() {
    return {
      form: {
        name: "",
        desc: ""
      },
       data: [{
          id: 1,
          label: '控制台',
          children: [{
            id: 4,
            label: '控制台',
            children: [{
              id: 11,
              label: '数据情况'
            }, {
              id: 12,
              label: '快捷入口'
            }]
          }]
        }, {
          id: 2,
          label: '装备管理',
          children: [{
            id: 5,
            label: '装备分类',
            children: [{
              id: 13,
              label: '查看'
            }, {
              id: 14,
              label: '管理'
            }]
          }, {
            id: 6,
            label: '装备管理',
            children: [{
              id: 15,
              label: '查看'
            }, {
              id: 16,
              label: '管理'
            }]
          }]
        }, {
          id: 3,
          label: '维修器材',
          children: [{
            id: 7,
            label: '器材分类',
            children: [{
              id: 17,
              label: '查看'
            }, {
              id: 18,
              label: '管理'
            }]
          }, {
            id: 8,
            label: '器材管理',
            children: [{
              id: 19,
              label: '查看'
            }, {
              id: 20,
              label: '管理'
            }]
          },
          {
            id: 9,
            label: '器材入库',
            children: [{
              id: 21,
              label: '查看'
            }, {
              id: 22,
              label: '管理'
            }]
          },
          {
            id: 10,
            label: '器材领用',
            children: [{
              id: 23,
              label: '查看'
            }, {
              id: 24,
              label: '管理'
            }]
          }
          ]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        }
    };
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    }
  }
};
</script>